package com.yurun.service.impl;

import com.yurun.entity.BCategory;
import com.yurun.exception.PersistenceException;
import com.yurun.mapper.BCategoryMapper;
import com.yurun.service.BCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BCategoryServiceImpl implements BCategoryService {
    @Autowired
    BCategoryMapper bCategoryMapper;

    @Override
    public void addBcategory(BCategory bCategory){
        if(bCategoryMapper.addBcategory(bCategory)!=1){
            throw new PersistenceException("添加业务分类失败");
        }
    }

    @Override
    public void deleteBcategoryById(Long id){
        if(bCategoryMapper.deleteBcategoryById(id)!=1){
            throw new PersistenceException("删除业务分类失败");
        }
    }

    @Override
    public List<BCategory> getBCategoryList(){
        return bCategoryMapper.getBCategoryList();
    }
}
